package collection;


import java.util.ArrayList;

import java.util.Arrays;
import java.util.Collection;

public class CollectionToArrayDemo {
    public static void main(String[] args) {
        Collection<String>c=new ArrayList<>();
        c.add("a");
        c.add("b");
        c.add("c");
        c.add("d");
        c.add("e");
        System.out.println(c);
        Object[]array=c.toArray();
        String[]array1=c.toArray(new String[10]);
        String[]array2=c.toArray(new String[c.size()]);
        String[]array3=c.toArray(new String[1]);
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(array1));
        System.out.println(Arrays.toString(array2));
        System.out.println(Arrays.toString(array3));


    }
}
